import { request } from '@/service/request';

// =============== OrgUnit Begin ===============

/** get org page list */
export function fetchGetOrgUnitPageList(params?: Api.SystemManage.OrgUnitSearchParams) {
  return request<Api.SystemManage.OrgUnitPageList>({
    url: '/sys_org_unit/page',
    method: 'GET',
    params
  });
}

/** add org info */
export function fetchAddOrgUnit(data: Api.SystemManage.OrgUnitEdit) {
  return request<boolean>({
    url: '/sys_org_unit/',
    method: 'POST',
    data
  });
}

/** get org info */
export function fetchGetOrgUnit(id: string) {
  return request<Api.SystemManage.OrgUnit>({
    url: `/sys_org_unit/${id}`,
    method: 'GET'
  });
}

/** update org info */
export function fetchUpdateOrgUnit(data: Api.SystemManage.OrgUnitEdit) {
  return request<boolean>({
    url: '/sys_org_unit/',
    method: 'PUT',
    data
  });
}

/** edit delete org */
export function fetchDeleteOrgUnit(data: Api.Common.DeleteParams) {
  return request<boolean>({
    url: '/sys_org_unit/',
    method: 'DELETE',
    data
  });
}

/** get org page tree */
export function fetchGetOrgUnitTree() {
  return request<Api.SystemManage.OrgUnitTree[]>({
    url: '/sys_org_unit/fetch_my_tree',
    method: 'GET'
  });
}

/** 获取我的省市县 */
export function fetchGetMyUniqueProvinceCityCounty() {
  return request<Api.SystemManage.ProvinceCityCountyInfo>({
    url: '/sys_org_unit/fetch_my_province_city_county_info',
    method: 'GET'
  });
}

// =============== OrgUnit End  ===============
